Skip to content

Commit

Permalink
tinystash.undef.im: support multiple files and append an extension
Browse files Browse the repository at this point in the history
  • Loading branch information
l29ah committed May 30, 2022
1 parent 3d306f7 commit ec1f474
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tinystash.undef.im/tinystash
@@ -1,6 +1,8 @@
#!/bin/sh
if ! mime=$(file -Eb --mime-type "$1"); then
echo "$mime"
exit 1
fi
exec curl https://tinystash.undef.im/upload/file -H app-id:"${W3CRAPCLI_TINYSTASH_APP_ID:-w3crapcli}" -H content-type:"$mime" --data-binary @"$1"
for f in "$@"; do
if ! mime=$(file -Eb --mime-type "$f"); then
echo "$mime"
exit 1
fi
curl https://tinystash.undef.im/upload/file -H app-id:"${W3CRAPCLI_TINYSTASH_APP_ID:-w3crapcli}" -H content-type:"$mime" --data-binary @"$f" | sed -e "s,$,.${f##*.},"
done

0 comments on commit ec1f474

Please sign in to comment.